/*
 * Copyright (c)  2020,  DataPipeline
 * All rights reserved.
 *
 * Id:BlobJavaSqlTypeHandler.java   2020-07-18 21:26 wanglijun
 */
package cn.datacare.orm.mapping.type.handler;

import cn.datacare.orm.mapping.type.JavaSqlTypeHandler;
import cn.datacare.orm.mapping.type.TypeParameter;

import java.sql.Blob;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: Copyright (c) 2020
 * </p>
 * <p>
 * Company/Department: DataPipeline
 * </p>
 *
 * @author wanglijun
 * @version 1.0
 * @since 2020-07-18 21:26
 */
public class BlobJavaSqlTypeHandler implements JavaSqlTypeHandler {

    /***
     *   基础类，用来sql到java，java到sql的映射
     * @param typeParameter
     * @return Object
     * @throws SQLException
     */
    @Override
    public Object getValue(TypeParameter typeParameter) throws SQLException {
        ResultSet resultSet = typeParameter.getResultSet();
        Blob value = resultSet.getBlob(typeParameter.getIndex());
        return value;
    }
}
